home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / graphics / model3d.zip / SURFMODL.DOC < prev    next >
Text File  |  1991-11-24  |  69KB  |  1,275 lines

  1.  
  2.  
  3.                     USER'S GUIDE TO SURFMODL 3.00C
  4.  
  5.  
  6.                         By Kenneth E. Van Camp
  7.                             November, 1991
  8.  
  9.  
  10.                            TABLE OF CONTENTS
  11.  
  12. INTRODUCTION ............................................... 2
  13.  
  14. REFERENCES ................................................. 3 
  15.  
  16. USING SURFMODL ............................................. 4 
  17.  
  18. INTERACTIVE OPERATION ...................................... 5
  19.  
  20. CONFIGURATION/INITIALIZATION FILE FORMAT ................... 9
  21.  
  22. SURFMODL DATA FILE FORMAT ..................................11
  23.  
  24. USING PREPROC ..............................................13
  25.  
  26. PREPROC DATA FILE FORMAT ...................................15
  27.  
  28. USING PLAYBACK .............................................19
  29.  
  30. USING REVOLUTION ...........................................21
  31.  
  32. USING SURFEDIT .............................................23
  33.  
  34. PRINTING THE SCREEN ........................................25
  35.  
  36. INSTRUCTIONS FOR RECOMPILING SURFMODL 2.00C ................26
  37.  
  38. INTERPRETATION OF ERROR MESSAGES ...........................27
  39.  
  40. SURFMODL USER REGISTRATION .................................29
  41.  
  42. UPGRADING SURFMODL .........................................30
  43.                              INTRODUCTION
  44.  
  45.  
  46.       Surface modeling is the science of producing realistic three-
  47. dimensional images on a computer display.  SURFMODL is a public
  48. domain surface modeling program that runs on the IBM PC and most
  49. compatibles.  Specifically, it supports the IBM CGA, MCGA, EGA,
  50. VGA, PC3270, AT&T 6300, and Hercules graphics adapters.  There is
  51. also limited support for the DEC VAXMATE and Commodore Amiga
  52. computers.  Earlier versions of SURFMODL (versions 1.32 and
  53. earlier) also supported the Sanyo MBC-550 and Heath/Zenith Z100; 
  54. this support does not presently exist in version 3.00C.  SURFMODL
  55. requires only 256K RAM, runs amazingly fast, and is a general-
  56. purpose surface modeler.  It creates displays of three-dimensional
  57. wire frame images, removes hidden lines, and performs surface
  58. modeling.  Since it is a generalized program, it can be used to
  59. view any object from any angle, with single or multiple light
  60. sources.  It is accompanied by PREPROC (a general-purpose non-
  61. interactive preprocessor), REVOLUTE (a special-purpose interactive
  62. preprocessor for generating objects of revolution), SURFEDIT (a
  63. general-purpose interactive data file editor), 3DSURF (a special-
  64. purpose preprocessor for generating 3-D function data files), 
  65. PLAYBACK (a general-purpose program to replay saved SURFMODL
  66. screens to create animations and demonstrations), and PLAYPAL (a
  67. program to allow experimentation with the color palette of a VGA or
  68. Super VGA).  This file contains instructions for the use of most of
  69. these.  Source code for all of these utilities (over 5000 lines of
  70. Turbo Pascal source code) are included on the distribution
  71. diskettes.  At the end of this file are some special notes on
  72. becoming a registered user of SURFMODL (for free).
  73.        SURFMODL is placed in the public domain.  SURFMODL may be
  74. freely distributed, or distributed at nominal copying/mailing fee,
  75. but may not be otherwise charged for.  No warranty is provided,
  76. either express or implied.  SURFMODL may not be incorporated into
  77. commercial software without express written permission of the
  78. principle author:
  79.           Kenneth Van Camp
  80.           RD #1 Box 1255
  81.           East Stroudsburg, PA  18301   U.S.A.
  82.       Surface modeling is often confused with solids modeling,
  83. which encompasses surface modeling but includes much more.  The
  84. pictorial results are often equivalent, however, so the distinction
  85. is not important if the objective is to produce spectacular
  86. graphics.  To use common solid modeling terminology, SURFMODL is a
  87. boundary representation (B-Rep) solid modeler for flat surfaces of
  88. any number of sides.  (All surfaces are polygons of any order.)   
  89.    Applications of surface modeling are many and growing.  SURFMODL
  90. was originally written to display finite element data and plots of
  91. three-dimensional curves.  Computer-aided styling, general CAD/CAM,
  92. and artistic rendering are among the many applications at which
  93. SURFMODL excells.  If you would like to learn more about SURFMODL,
  94. beyond this user's guide, there are several references provided
  95. below.
  96. REFERENCES
  97.  
  98. 1. Bickel, Marilyn and Sheppard, Gene, "A Simple 3-D Surface",
  99. Journal of Pascal, ADA & Modula-2, Nov/Dec 1985, 12-23.
  100.  
  101. 2. Haroney, George, "Graphing Quadric Surfaces", Byte, Dec. 1986,
  102. 215-224.
  103.  
  104. 3. Crow, Franklin gw, "Shadow Algorithms for Computer Graphics",
  105. Computer Graphics, Vol. 11 No. 2, Summer 1977.
  106.  
  107. 4. Newman, William M. and Sproull, Robert F., Principles of
  108. Interactive Computer Graphics, 2d ed., McGraw-Hill, New York, 1979.
  109.                             USING SURFMODL
  110.  
  111.  
  112.       When used in conjunction with a finite element preprocessor,
  113. a special-purpose function generation routine, or one of SURFMODL's
  114. preprocessors, SURFMODL is a complete surface modeling system,
  115. capable of constructing models of any variety of objects of
  116. virtually unlimited complexity.
  117.        Because SURFMODL is in the public domain, and is distributed
  118. with full source code, it has attracted the attention of many PC
  119. hackers, as well as educators.  (There are at least two teachers
  120. now using SURFMODL in their computer graphics classes.)  SURFMODL
  121. has the distinction of running on many different MSDOS systems, due
  122. to the support it has received from many users worldwide.  Special
  123. recognition should be given to Kevin Lowey, who converted SURFMODL
  124. and PREPROC to run under Turbo Pascal 4.0.  Kevin also wrote
  125. PLAYBACK, added SURFMODL support for the Borland Graphics Interface
  126. (BGI) device independent graphics, and made several other
  127. enhancements to the program.  Ian Murphy should also be recognized,
  128. for his work adding support for heap memory (to drastically
  129. increase the maximum number of surfaces SURFMODL can handle on
  130. machines with at least 512K RAM), and for writing REVOLUTE and
  131. SURFEDIT.  Both of these programs, incidentally, must still be
  132. compiled under Turbo Pascal 3.01A;  the rest of the programs in
  133. this package must be compiled under Turbo Pascal 4.0 or higher. 
  134. See the file 300NOTES.TXT for notes about compiling this release. 
  135. Amnon Levav should also be recognized, for writing the 3DSURF
  136. program.
  137.        With version 3.0, the limit on the complexity of the object
  138. SURFMODL can model is no longer dependent on how it was compiled. 
  139. SURFMODL dynamically allocates all the major arrays in the program,
  140. so you can run as large a model as will fit in your computer's
  141. conventional memory.  (There is no support for extended or expanded
  142. memory in SURFMODL, but PLAYBACK supports extended memory for
  143. longer animations.)
  144.                          INTERACTIVE OPERATION
  145.  
  146.  
  147.       Invoking SURFMODL from DOS is accomplished by a command of
  148. the form:
  149.      SURFMODL [filename [menuopt [keystroke]]]
  150. where the filename is the optional specification of a SURFMODL data
  151. file.  If a filename is not specified on the command line, it must
  152. be read by menu options.  If a filename is specified on the command
  153. line, it is read in immediately.  If a menu option is also
  154. specified on the command line, then SURFMODL bypasses the title
  155. screen and main menu and immediately draws the screen.  This can be
  156. useful for demonstrations, or automating SURFMODL usage through
  157. batch files.  Legal values for menuopt are 2, 3 or 4.  Finally, if
  158. a menu option is given on the command line, then you can also
  159. optionally add a single-letter keystroke that tells SURFMODL what
  160. to do when it is all done plotting.  Currently the only keystroke
  161. that makes any sense to use here is 'f', which means that SURFMODL
  162. should automatically save the screen to a file and exit when it is
  163. done plotting.  (See MOLECULE.DOC and MKMOVIE.BAT for an example of
  164. how to use this.)
  165.        When SURFMODL is started without the menuopt parameter, or
  166. with no parameters at all, the main menu appears.  Menu options are
  167. selected by pressing the number corresponding to the option
  168. desired.  Option 0 always returns to the previous menu or, in the
  169. case of the main menu, exits the program.  Pressing the space bar
  170. or escape key is equivalent to pressing 0.
  171.        Option 5 of the main menu is generally the one you will
  172. start with.  It brings up a file selector box to allow you to
  173. choose a data file.  It searches the current directory for all
  174. files with a '.SRF' extension.  (However, if you set a value for
  175. the environment variable SURFDIR prior to starting SURFMODL, the
  176. program will search in that directory instead of the current
  177. directory.)
  178.        Options 2, 3 and 4 of the main menu will start the plotting
  179. of the selected data set in wire frame, hidden line removal, or
  180. surface modeling.  During plotting, any time the user hits the 'A'
  181. key, the plot is aborted and the main menu is returned.  When
  182. plotting is complete, the program will wait for a keypress before
  183. returning to the main menu.  In general, any keypress will return
  184. the main menu; however there are two special keys:  F and P.  The
  185. 'F' key causes the current screen to be saved in a binary file
  186. called 'myfile.1', where we are assuming the original data file was
  187. called 'myfile.SRF'.  Actually, what happens here is that SURFMODL
  188. checks for the existence of the file 'myfile.1' before creating it;
  189. if that file already exists then it tries 'myfile.2', etc.  This
  190. allows you to do several screen saves without having to worry about
  191. overwriting your old data files.
  192.        PICture files can be replayed with a special program called
  193. PLAYBACK (described later in this documentation).  PICTURE FILES
  194. ARE SPECIFIC TO THE GRAPHICS DEVICE BEING USED, and cannot be used
  195. on other devices.
  196.        The 'P' key enters a pause mode, whereby all keystrokes are
  197. ignored except the letter 'P', which then exits the pause mode. 
  198. Then any other keystroke brings up the main menu.
  199.        Option 1 of the main menu selects the parameters menu.  This
  200. menu allows the user to change numerous viewing, system, and file
  201. parameters, and to save any of these parameters to disk.  All
  202. numeric inputs in the menus have a common prompt.  You are
  203. presented with the name of the input, the value presently being
  204. used, and an equal sign.  For instance, the prompt to enter a new
  205. X coordinate for the eye looks like:
  206.        X of Eye ( 100.0 ) =
  207. Hitting just the <return> key will keep the old value (in this
  208. case, 100).  Typing any number instead will make that be the new
  209. value used.
  210.        There are six options in the parameters menu.  Options 2 and
  211. 3 set up the viewing angles by selecting three-dimensional
  212. coordinates of the viewer's eye and focal point.  The distance
  213. between the eye and focal point is important, since SURFMODL uses
  214. perspective plotting.  To start, always place the eye far from the
  215. focal point to avoid excessive distortion.  The focal point is
  216. important because this point is always placed at the center of the
  217. screen.  If the focal point is placed so that it lies outside the
  218. limits of the object, a warning message will be issued.  This does
  219. not necessarily mean the plot will not be visible, but is merely
  220. meant to warn the user that his plot may not be within the limits
  221. of the screen.  If a blank screen results, the user should move the
  222. focal point closer to the center of the object.
  223.        Option 4 selects the magnification factor.  A magnification
  224. of 1 makes the plot as large as possible without exceeding the
  225. screen limits in either the X or Y direction.  To zoom in on a
  226. particular area of the figure, be sure to move the focal point to
  227. that area to center it on the screen, then gradually increase the
  228. magnification.
  229.        Option 5 of the parameters menu selects the view type.  By
  230. default, all plots are made in perspective view (selection 0). 
  231. This is almost always the option you should choose.  The only time
  232. a non-perspective drawing is done is when one of the orthogonal
  233. views is selected (X-Y, X-Z, or Y-Z).  In this case, the eye
  234. coordinates are ignored.
  235.        After selecting a view type, you will be asked if you want
  236. to show the axes.  Typing Y will place coordinate system axes,
  237. labeled X, Y and Z at the lower left corner of all plots
  238. subsequently produced. This can be useful when trying to decide how
  239. to adjust eye coordinates.  If you select axis drawing, you will be
  240. asked for the length to draw the axes in the X, Y and Z directions. 
  241. These numbers are input in world coordinates, and should generally
  242. be about 10-20% of the maximum dimension in the data file. 
  243. Finally, you are asked for a color to draw the axes.  Again, make
  244. sure you choose a valid color for your system.
  245.        Option 6 saves all of your current settings to a file with
  246. the same name as your data file, but with an extension of .INI. 
  247. When a new data file is read with option 5 of the main menu (or
  248. specified on the command line), SURFMODL automatically searches the
  249. disk for the .INI file.  If it exists, it is read in and used to
  250. initialize numerous parameters.  Every setting in the parameters
  251. menu and the lighting menu is copied into the .INI file, plus there
  252. are some others that are not available in the menus but can be
  253. manually typed in by editing the .INI file.  See the section on
  254. Configuration/Initialization files.
  255.        There is a small redundancy between the main data file and
  256. the .INI file.  Material properties can be set either in the main
  257. data file or in the lighting menu, and are therefore saved in the
  258. .INI file. Since the .INI file is read after the main file, the
  259. material properties saved in the .INI file will be the final ones
  260. used in the program.
  261.        Option 1 of the parameters menu selects the lighting menu. 
  262. The lighting menu has five options.  Option 1 of the lighting menu
  263. allows the user to change material properties.  The user should
  264. know what material numbers were specified for the surfaces in the
  265. data file.  R1, R2 and R3 are reflectivity constants, which are
  266. used in the equation for the reflected light intensity:
  267.      E = I[R1(cos s)**R2 + R3cos n] + Ambient 
  268. where I is the incident light intensity, s is the angle between the
  269. reflected light vector and the line of sight, n is the angle
  270. between the light source and the surface normal (i.e., independent
  271. of the viewing angle), and **R2 means "raised to the R2 power".  
  272.        The ambient light intensity can be set for each material
  273. individually, so that different parts of the solid can be given
  274. different intensities.  (This is one way to make a piece of an
  275. object stand out against the background of another piece.  It can
  276. also be used to give the illusion of different colors on a
  277. monochrome monitor.) Light intensity is a real number between zero
  278. and one, with zero corresponding to black and one to white. 
  279. Ambient light is usually set to a low level of around 0.1 - 0.3.  
  280.       The color selected for the material is used for wireframe and
  281. hidden line plots, and for surface modeling if the dithering option
  282. is selected.  Entering a color number of 0 brings up three
  283. additional prompts, for the Red, Green and Blue values.  These
  284. values are only used on VGA systems, or for the special Amiga IFF
  285. version of SURFMODL, SURFIFF (see SURFIFF.DOC for details).  These
  286. values should be in the range from 1 to 256, with representing no
  287. color and 256 representing full color intensity.  To help you
  288. experiment to find the best color combinations for your SURFMODL
  289. files, there is a special utility called PLAYPAL.  There is no
  290. documentation on this utility, but it should be fairly self-
  291. explanatory (there is a help screen by pressing F1).
  292.     Option 2 changes the light source data.  Light source number
  293. one is the primary light source, and is the one used for shadowing
  294. calculations.  The first prompt at this option is for the light
  295. source number.  Entering a zero will delete the last light source
  296. (if there is more than one).  You may add a new light source by
  297. entering a number that is one greater than the current number of
  298. light sources.  The user is prompted for the new coordinates of the
  299. light source, and the intensity associated with it.  As before,
  300. this number is usually between zero and one, although larger
  301. numbers can be used for very bright lighting.  On color monitors
  302. (other than the VGA in 256-color mode), the dithering tends to
  303. darken the picture, so you may want to experiment with brighter
  304. lighting.  If the lighting is too bright, the picture will become
  305. washed out and features will be indistinguishable.
  306.        Option 3 changes Epsilon, the constant for Gouraud
  307. interpolation (smoothing).  Entering zero will result in no
  308. interpolation whatsoever.  Entering any other value will invoke the
  309. Gouraud interpolation option.  This is a simple 3-dimensional
  310. interpolation scheme that will artificially "smooth out" shading of
  311. curved objects. Because SURFMODL uses flat surfaces for all
  312. plotting, curved objects (like FACES.SRF, the data file on the
  313. distribution diskette of my wife's face) normally look very patchy. 
  314. The Gouraud option will smooth this out by averaging shading at the
  315. nodes and interpolating between them. The only problem with Gouraud
  316. interpolation is that sharp corners (which you may desire) tend to
  317. get washed out and look rounded. Therefore, Epsilon is a difference
  318. option.  If the shades of any neighboring surfaces differ by more
  319. than Epsilon, they are not interpolated.  A good value of Epsilon
  320. is usually around 0.3, but other values may be necessary for
  321. special cases.
  322.        If you selected the Gouraud option (by entering a value of
  323. Epsilon greater than 0), then you are next prompted for a random
  324. shading value.  The user is encouraged to enter a random shade of
  325. 0 the first time he views any Gouraud-interpolated image.  If you
  326. find that the interpolation has created sharp lines of definition
  327. between neighboring shades, then you may want to go back and add a
  328. random shade (RandShade).  The number you enter for RandShade
  329. causes SURFMODL to randomly select a number in the range of 0 -
  330. RandShade for each pixel, and add it to the lighting value for that
  331. pixel.  RandShade should never be greater than one.
  332.        Option 4 selects (or deselects) the shadowing option.  This
  333. option will significantly increase computation time, so it should
  334. not be used until all viewing and lighting angles have been
  335. thoroughly tested.  This option has never worked very well, so I
  336. usually disable it in the executable I send out in releases (this
  337. saves quite a bit of memory).
  338.                 CONFIGURATION/INITIALIZATION FILE FORMAT
  339.  
  340.        There are two types of files discussed in this section.  One
  341. is the SURFMODL configuration file, and the other is the data
  342. initialization files.  In fact, these two files have identical
  343. formats and have a good deal of overlap in functionality.  Here's
  344. the specifics:
  345.        When SURFMODL is started, it looks for a file called
  346. SURFMODL.CFG.  If it doesn't find it in the current directory, then
  347. it checks to see if you have defined an environment variable called
  348. SURFDIR (see your MSDOS manual's explanation of the SET command),
  349. and if so uses the specified directory for locating SURFMODL.CFG. 
  350. If it doesn't find SURFMODL.CFG, it kicks you out.
  351.        If it does find SURFMODL.CFG, that file is read and all the
  352. options in the file are used to initialize many parameters.  Most
  353. important of these is GRSYS and GRMODE, which set the graphic
  354. system type and graphics mode to plot in.  SURFMODL.CFG is most
  355. easily created by running the installation program, SURFINST, but
  356. if you want you can create it manually.  SURFINST will
  357. automatically detect your system type, and present you with a menu
  358. of available graphics modes for your system (if there is more than
  359. one).
  360.        When you read in a new file (either by specifying it on the
  361. command line or through the file selector), SURFMODL checks for a
  362. file of the same name with a .INI extension.  If it exists, all
  363. parameters saved in the file are read and used to set up the next
  364. plot.  The .INI file is normally created by using the "Save
  365. Parameters" option in the Parameters Menu.
  366.        Since SURFMODL.CFG and the .INI files share many of the same
  367. commands, you can use SURFMODL.CFG to set defaults for how you
  368. usually like to view files.  And since the .INI files are always
  369. read AFTER the SURFMODL.CFG file, any parameters you save in there
  370. will override the SURFMODL.CFG file whenever you read in that data
  371. file.
  372.        OK, enough about usage.  The file format is pretty simple,
  373. and includes a number of symbolic commands.  Like all the SURFMODL
  374. data files, an asterisk in the first column of any line makes that
  375. line a comment, and it is ignored.  Otherwise, all lines must be of
  376. the format:
  377.  
  378. cmmd: parameters
  379.  
  380. where 'cmmd' is one of the valid commands, listed below.  All
  381. commands are in capital letters, and you MUST type them that way;
  382. SURFMODL will not recognize these commands in lower case.  Of
  383. course, you normally will not type in these lines at all, since the
  384. file will be created automatically with the "Save Parameters"
  385. option.  You might want to edit it to change some values, however,
  386. since there are some options available through the .INI files that
  387. are not available through the menus.  (The converse is not true,
  388. however; all menu parameters are saved in the .INI file.)
  389.        Here is a summary of the available commands.  An asterisk
  390. next to the command name means it is valid in both the SURFMODL.CFG
  391. file and the .INI files; two asterisks means it is only valid in
  392. the SURFMODL.CFG file; no asterisks means it is only valid in the
  393. .INI files.  Some of the parameters are symbolic, while others are
  394. numeric.  Where they are symbolic, I have followed the description
  395. with a list of valid symbols, enclosed in braces ({}).  For
  396. example, { ON, OFF } means that valid parameters are the words "ON"
  397. or "OFF" (case-sensitive, again).
  398.  
  399.   COMMAND      PARAMETERS     DESCRIPTION
  400. **GRSYS        system         Graphic System Type
  401. **GRMODE       mode           Graphics Mode
  402.  *VERSION      num            Version Number of .CFG/.INI file
  403.  *EYE          x y z          Coordinates of eye
  404.  *FOCAL        x y z          Coordinates of focal point
  405.  *MAGNIFY      val            Magnification factor
  406.  *VIEWTYPE     type           View Type { STD, XY, YZ, XZ }
  407.   MATL         n              Set Material Number (applies to all
  408.                               following MAT* commands)
  409.   MATCONST     r1 r2 r3       Set Material Constants
  410.   MATCOLOR     n              Color to plot material
  411.   MATAMBIENT   val            Ambient light intensity
  412.   MATRGB       r g b          Set RGB values for color (overrides
  413.                               MATCOLOR on VGA systems)
  414.  *LIGHT        n              Set Light Number (applies to all
  415.                               following LT* commands)
  416.  *LTCOORD      x y z          Set Light Source Position
  417.  *LTINTENS     val            Light Source Intensity
  418.  *GOURAUD      epsilon        Epsilon, or 0 if no smoothing
  419.  *SHADOWING    opt            Select Shadowing Option? { ON, OFF }
  420.  *AXISSHOW     opt            Show Axes? { ON, OFF }
  421.  *AXISLEN      x y z          Length of 3 axes to draw
  422.  *AXISCOLOR    n              Color to plot axes
  423.  *RANDOM       randshade      Random number to add to all shades
  424.                               (0 to turn off option)
  425.  *BORDERS      opt            Show the borders of all surfaces?
  426.                               { ON, OFF }
  427.  *TEXTCOL      n              Color# to use in text mode
  428.  *BGCOL        n              Background color# in text mode
  429.  *GRAPHTEXT    n              Color# to display title on plots
  430. **REVVIDEO     opt            Reverse all text video? { ON, OFF }
  431.  *SHOWTITLE    opt            Show title on plot? { ON, OFF }
  432. **XYADJUST     val            X-Y Adjustment factor (changes aspect
  433.                               ratio of screen)
  434.                        SURFMODL DATA FILE FORMAT
  435.  
  436.  
  437.       All input in the main data file is line oriented, in free
  438. format.  The separator between lines is a carriage return, and the
  439. separator between data items on a line is a space, tab or comma. 
  440. Any line that begins with an asterisk (*) in the first column is a
  441. comment, and is ignored.  This is true anywhere AFTER the first
  442. line of the file, which contains the Title for the file.  If you
  443. put an asterisk on the first line, you'll just get a title that
  444. starts with an asterisk.
  445.        The data file can be created in any ASCII line editor (like
  446. Edlin, or the Turbo Pascal editor), or by one of the SURFMODL
  447. preprocessors.
  448.        Following is the format for the main data file.  Numbers in
  449. brackets indicate the range of legal inputs.
  450.  
  451.  
  452.                               Title Line
  453. (The first line of the data file is the title of the plot.)
  454.  
  455.  
  456.                              Version Line
  457.  
  458. Variable             Description                                Type
  459. VERSION     Version Number of SURFMODL data file format [4]   Integer
  460. (This set of instructions is for data file format number 4.)
  461.  
  462.  
  463.                              Control Line
  464.  
  465. Variable             Description                                Type
  466. NMATL       Total number of materials in solid [1..20]        Integer
  467. NNODES      Total number of nodes in solid [1..1024]          Integer
  468. NSURF       Total number of surfaces in solid [1..3000/MAXV]  Integer
  469. MAXVERT     Maximum number of vertices in any one surface     Integer
  470. NSIDES      Number of sides of the surface to use [1..2]      Integer
  471.  
  472. A note on NSIDES:  For most objects, use NSIDES=1 to get the
  473. fastest plotting.  NSIDES=2 is really only provided for plotting
  474. three dimensional functions, and other objects that really don't
  475. have any "depth" (i.e., the surfaces have a thickness of 0).  For
  476. normal objects (NSIDES=1), the "visible side" of a surface is
  477. defined as the one that is visible when viewing the surface from a
  478. side such that the nodes are numbered in a counter-clockwise
  479. direction.  When SURFMODL computes the angle of a surface relative
  480. to the eye (which it does for both hidden line and shaded plots),
  481. it will not plot any surfaces that are at an angle of greater than
  482. 90 degrees from the eye vector (to save plotting time).  If you set
  483. NSIDES=2, then SURFMODL will use BOTH sides of the surface, so
  484. every surface is guaranteed to be plotted, whether it faces the eye
  485. or not.  (The counter-clockwise rule then doesn't matter.)
  486.  
  487.  
  488.                       Material Data (NMATL lines)
  489.  
  490. Variable             Description                                Type
  491. R1          First constant of material reflectivity [0..1]    Real
  492. R2          Second constant of material reflectivity          Real
  493. R3          Third constant of material reflectivity [0..1]    Real 
  494. COLOR       Color # to use for wireframe plotting [1..3]      Integer 
  495. AMBIENT     Ambient light intensity [0..1]                    Real
  496.  
  497.  
  498.                  Nodal Coordinate Data (NNODES lines)
  499.  
  500. Variable             Description                                Type 
  501. XWORLD      World X coordinate of node                        Real 
  502. YWORLD      World Y coordinate of node                        Real 
  503. ZWORLD      World Z coordinate of node                        Real
  504.  
  505.  
  506.                 Surface Connectivity Data (NSURF lines) 
  507. (NOTE: Connectivity data may be continued onto multiple lines.)
  508.  
  509. Variable             Description                                Type 
  510. NVERT       Number of vertices in this surface [3..MAXVERT)   Integer 
  511. MATL        Material number of this surface [1..NMATL]        Integer 
  512. NODE1       Node number of the first vertex [1..NNODES]       Integer 
  513. NODE2       Node number of the second vertex [1..NNODES]      Integer   
  514.   .                       .                                      .   
  515.   .                       .                                      .   
  516.   .                       .                                      . 
  517. NODE nvert  Node number of the Nverth vertex [1..NNODES]      Integer
  518.                              USING PREPROC
  519.  
  520.  
  521.       PREPROC is a special-purpose preprocessor for SURFMODL.  It
  522. allows the user to quickly generate SURFMODL data files consisting
  523. of objects of revolution, extrusion and simple planes.  It also
  524. allows multiple SURFMODL data files to be easily combined.  PREPROC
  525. is not interactive;  nor is it graphical.  However, the user will
  526. find it makes certain classes of objects very easy to create.  An
  527. example PREPROC input file, FAN.IN, is on the distribution diskette
  528. with SURFMODL.  The resulting SURFMODL data file, FAN.SRF, can be
  529. easily created by running PREPROC.  For a more elaborate PREPROC
  530. example, see the file MOLECULE.DOC for instructions on how to
  531. recreate the APPLE.SRF file that was provided with the release.
  532.        Before describing the details of the preprocessor data file,
  533. it is important to make a few notes.  A PREPROC data file consists
  534. of three major sections:  (1) the initial information, consisting
  535. of the title of the plot, control variables, and material data; 
  536. (2) codes for the input of one or more solids;  and (3) an ending
  537. code (0) marking the end of the input file.       If PREPROC is
  538. only being used to combine two or more old SURFMODL data files,
  539. then it is not necessary to specify material data in the initial
  540. section.  Material constants will be used from the individual data
  541. files, and PREPROC will automatically give them unique numbers to
  542. avoid conflicts.
  543.        Actually, there is one exception to this rule.  If PREPROC
  544. is started with the /R command-line option then this forces
  545. material numbers to be "re-used" when SURFMODL data files are read
  546. in.  This is used in the molecule example; in this case the
  547. material numbers are the same in each file and apply globally to
  548. all the data files.
  549.        When generating planes or objects of revolution or
  550. extrusion, material constants must be specified in the initial
  551. section.  Any plane or object of revolution or extrusion can be
  552. scaled, shifted or rotated in any of the three principle
  553. directions.  It is important to note the order in which these
  554. operations occur (in case more than one is used in a single
  555. object).  First, the object is rotated.  Then it is shifted, and
  556. finally scaled.  Orientation codes are also provided to allow the
  557. user to easily orient an object of revolution or extrusion about
  558. one of the major axes.  This is actually redundant to the use of
  559. the rotation angles, but is provided to make complex objects a
  560. little easier to generate.  An orientation code can be 1, 2 or 3,
  561. corresponding to the X, Y or Z axis, respectively.  The designated
  562. axis will then be the major axis of the object (the axis of
  563. revolution or extrusion).  It is important to note that we will
  564. refer to R-Z coordinates when speaking of objects of revolution,
  565. and X-Y-Z coordinates when speaking of objects of extrusion.  These
  566. are not to be taken as true X-Y-Z coordinates unless an orientation
  567. code of 3 is used.  If a different code is specified, then the
  568. major axis (referred to as 'Z' below), becomes whichever one is
  569. requested.  The other two axes are rotated to maintain a right-
  570. handed system.       Objects of revolution are specified by giving
  571. the R and Z coordinates of any number of outline points.  Once an
  572. outline is defined, it is rotated about the major axis, generating
  573. as many intermediate "slices" as specified by NSLICE.
  574.        Objects of extrusion are formed by specifying a top and
  575. bottom Z coordinate for the two endplanes.  Then the coordinates of
  576. the endplanes are given, in any amount of detail.  NOUTLN specifies
  577. the number of points to be used to describe the outline of the
  578. endplanes. NEXTRUDE tells how many "slices" to break the object
  579. into in the Z direction.  IQUAD is an option which, when selected
  580. (1), tells PREPROC to break down the two endplanes into
  581. quadrilaterals (to save storage space so you may keep MAXVERT=4). 
  582. When deselected (0), IQUAD tells PREPROC to keep your two endplanes
  583. exactly as you specified them.
  584.       The Planes option is merely to allow placement of large
  585. quadrilateral surfaces, broken down into many smaller quads.  This
  586. is useful to add a "floor" to an existing data set -- for instance
  587. if you want to experiment with shadowing.  The user specifies four
  588. sets of coordinates for the corners of a quad, and the number of
  589. smaller quads to break it into.  The numbers NX and NY have nothing
  590. to do with actual X and Y coordinates, but are merely to give a
  591. count of the number of smaller quads to use in the two directions
  592. along the larger quad.  The four corners must be specified in order
  593. so they form a counter-clockwise circular path when viewed from the
  594. visible side of the surface.  NX refers to the number of breaks in
  595. the direction traveled from node 1 to node 2;  NY refers to the
  596. other direction.
  597.        When using PREPROC to combine two or more old SURFMODL data
  598. files, material data sets will be added for each surface unless the
  599. /R option is used.  This is to avoid any conflicts between
  600. different material data sets.
  601.        Invoking PREPROC from DOS is accomplished by a command of
  602. the form:
  603.   PREPROC [/R] infile outfile
  604. where infile is the name of the PREPROC data file, and outfile is
  605. the name to be assigned to the output data file.  For instance, to
  606. preprocess the FAN.IN file, type:
  607.   PREPROC FAN.IN FAN.SRF
  608. (Note that the extension .IN is arbitrary and can be replaced by
  609. anything desired.  The .SRF extension on the output file is
  610. recommended, since that is what SURFMODL looks for when bringing up
  611. the file selector.)
  612.                        PREPROC DATA FILE FORMAT
  613.  
  614.  
  615.       All input in the preprocessor data file is line oriented, in
  616. free format.  Following is the format for the preprocessor data
  617. file. Numbers in brackets show the range of legal inputs.
  618.  
  619.  
  620.                               Title Line 
  621. (The first line of the data file is the title of the plot.)
  622.  
  623.  
  624.                              Version Line
  625.  
  626. Variable             Description                                Type 
  627. VERSION     Version Number of PREPROC  data file format [2]   Integer 
  628. (This set of instructions is for data file format number 2.)
  629.  
  630.  
  631.                              Control Line
  632.  
  633. Variable             Description                                Type 
  634. NMATL       Total number of materials in solid [0..20]        Integer 
  635. MAXVERT     Maximum number of vertices in any one surface     Integer 
  636. NSIDES      Number of sides of the surface to use [1..2]      Integer
  637.  
  638.  
  639.                       Material Data (NMATL lines)
  640.  
  641. Variable             Description                                Type 
  642. R1          First constant of material reflectivity [0..1]    Real 
  643. R2          Second constant of material reflectivity          Real 
  644. R3          Third constant of material reflectivity [0..1]    Real 
  645. COLOR       Color # to use for wireframe plotting [1..3]      Integer 
  646. AMBIENT     Ambient light intensity [0..1]                    Real
  647.  
  648. [The remaining set of data lines may be repeated as needed until all data has
  649. been inputted.]
  650.  
  651.  
  652.                               Shape Code
  653.  
  654. Variable             Description                                Type 
  655. CODE        Shape Code:  0 - End of data                      Integer  
  656.                          1 - Read old SURFMODL data file
  657.                          2 - Surface of revolution
  658.                          3 - Surface of extrusion
  659.                          4 - Planar quadrilateral surface
  660.  
  661.  
  662.                          READFILE Control Line
  663.                  (Include this section if CODE = 1.) 
  664. (This line should contain the name of a SURFMODL data file to be read in.)
  665.  
  666.                           Scale & Shift Line
  667.  
  668. Variable             Description                                Type 
  669. XSCALE      Scaling factor in X direction                     Real 
  670. YSCALE      Scaling factor in Y direction                     Real 
  671. ZSCALE      Scaling factor in Z direction                     Real 
  672. XSHIFT      Displacement in X direction                       Real 
  673. YSHIFT      Displacement in Y direction                       Real 
  674. ZSHIFT      Displacement in Z direction                       Real
  675.  
  676.  
  677.                               Rotate Line
  678.  
  679. Variable             Description                                Type 
  680. XROTATE     Rotation about X axis (degrees) [-360..360]       Real 
  681. YROTATE     Rotation about Y axis (degrees) [-360..360]       Real 
  682. ZROTATE     Rotation about Z axis (degrees) [-360..360]       Real
  683.  
  684.  
  685.                          REVOLVE Control Line 
  686. (Include this section if CODE = 2.)
  687.  
  688. Variable             Description                                Type 
  689. NOUTLN      Number of points describing outline of surface    Integer 
  690. NSLICE      Number of angular slices to create [1..]          Integer
  691. MATERIAL    Material number of this surface [1..20]           Integer 
  692. ORIENT      Orientation code [1..3]                           Integer
  693.  
  694.  
  695.  
  696.                           Scale & Shift Line
  697.  
  698. Variable             Description                                Type 
  699. XSCALE      Scaling factor in X direction                     Real 
  700. YSCALE      Scaling factor in Y direction                     Real 
  701. ZSCALE      Scaling factor in Z direction                     Real 
  702. XSHIFT      Displacement in X direction                       Real 
  703. YSHIFT      Displacement in Y direction                       Real 
  704. ZSHIFT      Displacement in Z direction                       Real
  705.  
  706.  
  707.                               Rotate Line
  708.  
  709. Variable             Description                                Type 
  710. XROTATE     Rotation about X axis (degrees) [-360..360]       Real 
  711. YROTATE     Rotation about Y axis (degrees) [-360..360]       Real 
  712. ZROTATE     Rotation about Z axis (degrees) [-360..360]       Real
  713.  
  714.  
  715.                   Outline Coordinates (NOUTLN lines)
  716.  
  717. Variable             Description                                Type 
  718. R           R coordinate                                      Real 
  719. Z           Z coordinate                                      Real
  720.  
  721.                          EXTRUDE Control Line 
  722. (Include this section if CODE = 3.)
  723.  
  724. Variable             Description                                Type 
  725. NOUTLN      Number of points describing outline of surface    Integer
  726. NEXTRUDE    Number of Z slices to create [1..]                Integer 
  727. IQUAD       Quadrilaterals option [1..2]                      Integer
  728. MATERIAL    Material number of this surface [1..20]           Integer 
  729. ORIENT      Orientation code [1..3]                           Integer
  730.  
  731.  
  732.                           Scale & Shift Line
  733.  
  734. Variable             Description                                Type 
  735. XSCALE      Scaling factor in X direction                     Real 
  736. YSCALE      Scaling factor in Y direction                     Real 
  737. ZSCALE      Scaling factor in Z direction                     Real 
  738. XSHIFT      Displacement in X direction                       Real 
  739. YSHIFT      Displacement in Y direction                       Real 
  740. ZSHIFT      Displacement in Z direction                       Real
  741.  
  742.  
  743.                               Rotate Line
  744.  
  745. Variable             Description                                Type 
  746. XROTATE     Rotation about X axis (degrees) [-360..360]       Real 
  747. YROTATE     Rotation about Y axis (degrees) [-360..360]       Real 
  748. ZROTATE     Rotation about Z axis (degrees) [-360..360]       Real
  749.  
  750.  
  751.  
  752.  
  753.                       Top & Bottom Z Coordinates
  754.  
  755. Variable             Description                                Type 
  756. ZTOP        Z coordinate of top surface                       Real 
  757. ZBOT        Z coordinate of bottom surface                    Real
  758.  
  759.  
  760.                   Outline Coordinates (NOUTLN lines)
  761.  
  762. Variable             Description                                Type 
  763. X           X coordinate                                      Real 
  764. Y           Y coordinate                                      Real
  765.  
  766.  
  767.                           PLANE Control Line 
  768. (Include this section if CODE = 4.)
  769.  
  770. Variable             Description                                Type 
  771. NX          Number of quads to break down - X [1..]           Integer 
  772. NY          Number of quads to break down - Y [1..]           Integer
  773. MATERIAL    Material number of this surface [1..20]           Integer
  774.  
  775.                           Scale & Shift Line
  776.  
  777. Variable             Description                                Type 
  778. XSCALE      Scaling factor in X direction                     Real 
  779. YSCALE      Scaling factor in Y direction                     Real 
  780. ZSCALE      Scaling factor in Z direction                     Real 
  781. XSHIFT      Displacement in X direction                       Real 
  782. YSHIFT      Displacement in Y direction                       Real 
  783. ZSHIFT      Displacement in Z direction                       Real
  784.  
  785.  
  786.                  Corner Coordinates (include 4 lines)
  787.  
  788. Variable             Description                                Type 
  789. X           X coordinate of corner                            Real 
  790. Y           Y coordinate of corner                            Real 
  791. Z           Z coordinate of corner                            Real
  792.                             USING PLAYBACK
  793.  
  794.  
  795.        PLAYBACK is a screen reviewing utility for SURFMODL, written
  796. by Kevin Lowey.  It allows you to create animated images by playing
  797. back SURFMODL PICture files, which were created by hitting the 'F'
  798. key in SURFMODL after a picture is generated on the screen.  Then
  799. you can replay any screen, or any sequence of screens, using
  800. PLAYBACK.
  801.        If you just type 'PLAYBACK' and hit Enter, the program will
  802. provide some brief instructions.  What it will tell you is that you
  803. should have specified a control file on the command line, as in:
  804.   PLAYBACK ctrlfile 
  805. where 'ctrlfile' should be replaced by the name of a control file
  806. you create.  In this control file, you will specify the names of
  807. SURFMODL PICture files that you have previously generated, along
  808. with a couple of options for displaying the files.
  809.        There is an important limitation to the PLAYBACK command: 
  810. files that were saved on a system with one type of graphics adapter
  811. can only be replayed on systems with the same type of graphics
  812. adapter.  This is because the PICture files are specific to the
  813. hardware being used.  You cannot, for instance, play back a PICture
  814. file on a Hercules graphics adapter that was created on an EGA
  815. system.
  816.        The control file format is extremely simple.  One line is
  817. used to specify each file name;  the format is "DELAY DISPLAYMODE
  818. FILENAME" for each line.  The three entries must be separated by at
  819. least one space. The delay is a time, in milliseconds (1/1000 of a
  820. second), to show the file before proceeding to the next one. 
  821. Specifying a delay of -1 will cause PLAYBACK to wait for a keypress
  822. before proceeding; a delay of -2 causes PLAYBACK to go back to the
  823. beginning screen and replay all the images again.  This causes an
  824. infinite loop, which is exited when any key is pressed.  Similarly,
  825. a delay of -3 causes an infinite loop, but in which the the images
  826. are displayed in reverse order until they reach the first image. 
  827. Then it displays them in forward order, etc., so that an
  828. oscillating animation can be created.  The display mode is an
  829. integer code between 0 and 4, as follows:
  830.      0 : Normal mode, image replaces image on screen.
  831.      1 : XOR mode, Shows image EXCEPT where it matches screen.
  832.      2 : OR mode,  Shows both image and screen.
  833.      3 : AND mode, Shows only where image and screen intersect. 
  834.      4 : NOT mode, Shows the inverse of the image.
  835.       For instance, suppose you had saved three PICture files
  836. consisting of images of the fan in different angles of rotation. 
  837. And suppose you had named these files FAN.1, FAN.2, and FAN.3.  You
  838. could replay all three of them, with one-second pauses between, by
  839. creating a playback control file as follows:
  840.           1000 0 FAN.1
  841.           1000 0 FAN.2
  842.           1000 0 FAN.3
  843. To create a continuous animation, add one more line:
  844.           -2 0 FAN.3
  845. (For an example of a looping animation, see APPLE.PLY.)
  846.       If you named this file FAN.PLY, then you could replay the
  847. images with the single command:
  848.            PLAYBACK FAN.PLY
  849. The extension of '.PLY' is not mandatory, but future versions of
  850. PLAYBACK will probably use this extension as a default.
  851.       Regarding memory usage: PLAYBACK requires enough free RAM to
  852. read ALL the disk images into memory before it starts to display
  853. any of them.  If there is not enough free RAM, it exits with an
  854. error message and you see none of your animation.  Following are
  855. some suggestions of what to do if you get this message:
  856.  
  857.   1. Remove any large memory-resident (TSR) programs that you may
  858. have loaded.
  859.   2. If you have extended memory in your system, you may want to
  860. install the HIMEM.SYS extended memory manager (provided with the
  861. SURFMODL distribution disks), or a compatible memory manager like
  862. QEMM, Netroom, or 386-Max.  New to version 3.0 is PLAYBACK's
  863. ability to store images in extended memory.  Unfortunately,
  864. PLAYBACK animations are somewhat slower when using extended memory,
  865. due to the extra memory moving involved.  Therefore, you will not
  866. see the smooth animations that are possible when only using
  867. standard RAM.
  868.   3. Edit the control file so there are not so many images in the
  869. animation.  This will cut down on RAM usage, since RAM usage is
  870. proportional to the number of images.
  871.   4. You can re-run SURFINST and select a lower-resolution graphics
  872. mode, or one with fewer colors.  If you have a VGA, you may even
  873. want to use one of the EGA modes or (gasp!) even a CGA mode.  Of
  874. course, the pictures will not look as sharp but at least you can
  875. see the animation.
  876.                            USING REVOLUTION
  877.  
  878.  
  879.        REVOLUTION provides a graphical interface to PREPROC, the
  880. SURFMODL preprocessor, for the generation of objects of revolution. 
  881. It was written by Ian Murphy.  This documentation should really be
  882. expanded on, but unfortunately I don't have time to do it more
  883. completely right now.  If you find this documentation incomplete or
  884. inaccurate, I recommend you use the trial-and-error method. 
  885. REVOLUTION is really quite easy to use, if you just play around
  886. with it a little.
  887.        You start up the program by just typing REVOLUTE (if you
  888. have a CGA, EGA, Hercules, or Sanyo MBC-55x) or REVOLHZC (if you
  889. have a Heath/Zenith Z-100 or CGA that can't run the standard
  890. REVOLUTE file), or REVOLATT (if you have an AT&T 6300).  There are
  891. no parameters on the command line.  For all versions except
  892. REVOLATT, you will then select your system type from a menu.
  893.        Next, you should immediately be placed on the graphics
  894. screen, with axes covering the screen and a small line segment and
  895. crosshair near the middle.  If you have a system that supports text
  896. output on the graphics screen, then you will also see a line that
  897. looks like:
  898.            Add Del Ins Move Redraw Params Write 
  899. at the top of your screen.  If your system doesn't support text on
  900. the graphics screen, then you had better write these commands down
  901. or you'll be lost when you start up REVOLUTION.
  902.        The basic idea is to draw a picture on your screen of HALF
  903. of the object that you wish to create (remember, you can only
  904. create objects of revolution).  The axis of rotation of the object
  905. is the vertical axis, and if you don't want a hole in your object
  906. you had better make sure that the first and last points of your
  907. picture lie on that axis. You move the crosshairs from one point to
  908. another on your lines using the left and right arrow keys.  Note
  909. that this only moves you between the "major" points that you have
  910. created.  Left arrow moves you in one direction and right arrow in
  911. the other.  These directions are not really necessarily left and
  912. right;  they are just backward and forward through the array of
  913. points you have drawn.  To move one of these major points, hit the
  914. M key.  If you receive the message to "select a point", then put
  915. the crosshair on the point you want to move and hit Enter.
  916. Otherwise, just hit your arrow keys and the current point will
  917. move. (If you don't have text capability on your graphics screen,
  918. you'll just have to tell by feeling your way around.  If left and
  919. right arrow keys just move the crosshairs between points, then
  920. REVOLUTION is still waiting for you to select a point;  if it moves
  921. your selected point left or right, then you are ready to go.) When
  922. you have moved the point where you want it, hit Enter and the point
  923. is kept at that place on the screen.
  924.        The first letter of all the commands mentioned above is all
  925. you press to select a command in REVOLUTION.  'A' adds a new point,
  926. always after the "leftmost" point -- that's easier to see by trying
  927. it than by reading this documentation.  'I' inserts a new point
  928. between two old points, again to the "left" of the chosen point. 
  929. 'D' deletes a point, and 'P' brings up a parameters menu to change
  930. several of the PREPROC inputs.  See the PREPROC documentation for
  931. details.  'W' writes the data to a file.  If you specify an
  932. extension to your filename, it is ignored;  REVOLUTION files always
  933. end in an extension '.IN'.  If (+%% '*ct a name like 'TEST' for
  934. your filename, then REVOLUTION will create two files:  TEST.IN and
  935. TEST.BAT.  The TEST.IN file is NOT a SURFMODL input file;  it is a
  936. PREPROC input file.  The easiest way to create a SURFMODL input
  937. file from this is to exit REVOLUTION (which you do by hitting the
  938. Escape key), and then type TEST.  This runs the TEST.BAT file,
  939. which just contains the two lines:
  940.            PREPROC test.IN test
  941.            SURFMODL test
  942. [KVC 09/30/91 This should be modified to generate test.SRF, but
  943. this has not been done yet.]
  944. This just runs the TEST.IN file that REVOLUTION just created
  945. through PREPROC to create a SURFMODL data file called TEST, then
  946. starts up SURFMODL on that file.
  947.        One other important note regarding REVOLUTION:  the ordering
  948. of the major points.  Since SURFMODL (and PREPROC) care about the
  949. ordering of nodes, some standard has to be set as to which node is
  950. the "first" one and which is the "last".  In SURFMODL, this was
  951. done by the restriction that nodal connectivity is specified in a
  952. counter-clockwise direction when viewed from the outside of the
  953. surface.  In REVOLUTION, in order to guarantee that nodes are
  954. generated properly for this rule, you have to follow some simple
  955. rules of ordering as well.  This is easiest to explain with an
  956. example.
  957.        If you imagine trying to create a sphere with REVOLUTION (by
  958. drawing a half-circle on the left side of the axis), the counter-
  959. clockwise rule is easy to apply if you just think of the "leftmost"
  960. point as the first one, and the "rightmost" point as the last. 
  961. That means the leftmost point should be at the top of the screen,
  962. and the rightmost point at the bottom.
  963.        In general, the rules are thus:  (1) always draw your object
  964. on the left side of the axis;  (2) always order the points counter-
  965. clockwise when proceeding from "left" to "right".  You can violate
  966. these rules, and still get valid SURFMODL data files, but you may
  967. find your surfaces "inverted":  SURFMODL shades the inside of the
  968. surface instead of the outside.
  969.        Experiment with REVOLUTION, and I think you'll agree it's a
  970. valuable addition to the SURFMODL package.  If you have problems
  971. with it, we apologize, but for now you'll just have to pour through
  972. the source code and figure it out yourself.  This brings new
  973. meaning to the term "user- supported software"!  Good luck!
  974.                             USING SURFEDIT
  975.  
  976.  
  977.       SURFEDIT is designed to allow you to edit any SURFMODL data
  978. file, to make small changes to it graphically or merge multiple
  979. data files interactively.  SURFEDIT was written by Ian Murphy, and
  980. really represents a valuable addition to the SURFMODL collection. 
  981. However, like REVOLUTION, it needs some work.  The file merging
  982. command, for instance, is buggy.  You may often find your data
  983. points in the wrong position after merging two files.  I ordinarily
  984. would not release such bug-ridden code, but SURFEDIT's primary
  985. purpose (graphically editing SURFMODL data files) works well and
  986. therefore (I think) makes it worthwhile nonetheless.  If you need
  987. to merge multiple SURFMODL data files, your best bet for now is to
  988. use PREPROC.
  989.        One more piece of bad news:  SURFEDIT currently only works
  990. on EGA-compatible systems.  Any other system will be hung by
  991. running SURFEDIT.      You start the program by just typing
  992. SURFEDIT;  any command line parameters are ignored.  You will be
  993. asked for a file name, and you must specify the name of an existing
  994. SURFMODL data file (NOT a PREPROC data file).  You must specify
  995. some file name here, since SURFEDIT cannot create a new one from
  996. scratch;  it must have an old file to start from.
  997.        Once SURFEDIT is started, you will be presented with three
  998. windows. These three windows always show the three principle
  999. orthogonal views of your object.  In drafting terminology, the
  1000. upper left view is called the "elevation";  the lower left is the
  1001. "plan";  and the upper right is the "endview".  These correspond to
  1002. the X-Y, X-Z and Y-Z planes, respectively.
  1003.        You have eight commands available to you in SURFEDIT, which
  1004. you specify by typing the first letter of the command:  Z (Zoom),
  1005. E (Edit), O (Options), R (Rotate), I (Import), T (Translate), M
  1006. (Magnify), and W (Write).  In addition, hitting the Escape key will
  1007. exit the program, and hitting one of the arrow keys will allow you
  1008. to "select" a different window.  You always know the selected
  1009. window because it is highlighted.  At all times, one of the three
  1010. windows is selected, and that is the one on which your commands
  1011. will operate.
  1012.        An explanation of the term "object" is in order.  In
  1013. SURFEDIT, an "object" is defined by a file.  The first data file
  1014. you specify to be read in is thereafter referred to as object
  1015. number 1.  If you later "Import" a file, it is referred to as
  1016. object number 2, the second file you Import is object number 3, and
  1017. so on.  (There is a limit of 10 objects in SURFEDIT.) In several of
  1018. the commands, SURFEDIT will ask you what object you wish to refer
  1019. to, so keep track of your object numbers.
  1020.        The Zoom command presents a rectangular box in the currently
  1021. selected window.  You may move this box anywhere inside the window,
  1022. to specify an area to zoom in on.  WARNING:  This command uses the
  1023. numbers on the numeric keypad, not real arrow keys!  Therefore, you
  1024. must have Num Lock ON when you issue this command.  (For anyone who
  1025. does not have the arrows printed on their numeric keypad, here is
  1026. the translation:  8 is the up arrow, 2 is the down arrow, 4 is the
  1027. left arrow, and 6 is the right arrow.) This is inconsistent with
  1028. the way the rest of the program works, by the way.  In any of the
  1029. other commands in SURFEDIT, when the directions say to hit an arrow
  1030. key it means a real arrow key (with Num Lock off).  When you have
  1031. positioned the box where you want to zoom, hit the Enter key to
  1032. actually make it zoom in.
  1033.        The Edit command allows you to move selected nodes in one
  1034. plane (the currently selected window).  You are limited to the
  1035. resolution of the graphics screen for the accuracy of your editing,
  1036. but since this command also works on zoomed windows you actually
  1037. have a great deal of control available.  After hitting the 'E' key,
  1038. you are presented with a crosshair.  You move the crosshair near
  1039. your desired node with the arrow keys, then hit Enter.  The closest
  1040. node to the crosshairs is selected, and the crosshairs reappear in
  1041. their original position.  Now move the crosshairs to the new place
  1042. where you want to move the node, and hit Enter.  You will not see
  1043. the change reflected in the other two windows immediately, but it
  1044. has been made internally.       To see your editing changes in
  1045. other windows, use the Options command, then hit 'R' for Reset. 
  1046. This redraws all three windows with the current data.  It also
  1047. resets any zooms to the initial drawing scales (the program
  1048. automatically scales your object to fit within all three windows,
  1049. with the same scale used in all windows).
  1050.        The Rotate command allows you to specify an angle (in
  1051. degrees) to rotate an object about each of the three principle
  1052. axes.
  1053.        The Import command allows you to read another SURFMODL data
  1054. file, to merge it with the current data file.
  1055.        The Translate command allows you to specify a distance to be
  1056. added to every coordinate in an object, along each of the three
  1057. principle axes.  Units used are real numbers (the same as the units
  1058. you used originally to create the data file).
  1059.        The Magnify command allows you to scale an object in each of
  1060. the three principle directions.  A scale of 1 leaves the object
  1061. unchanged in that direction.  Note that Magnify is different than
  1062. Zoom, because Zoom just allows you to enlarge the drawing of a
  1063. view.  Magnify actually changes the internal nodal coordinates of
  1064. the object.
  1065.        Finally, the Write command allows you to specify a file name
  1066. to save the current data into a SURFMODL data file.  It does not
  1067. exit the program;  use the Escape key for that.
  1068.                           PRINTING THE SCREEN
  1069.  
  1070.  
  1071.       SURFMODL does not provide an internal facility for printing
  1072. a copy of the graphics screen;  however it is fairly easy to do. 
  1073. If you have a CGA or EGA compatible graphics adapter and a printer
  1074. that is compatible with the IBM dot matrix graphics printers (as
  1075. many are, including the popular Epson printers), you can do screen
  1076. dumps using the GRAPHICS.COM program that comes with MSDOS. 
  1077. Install it by typing GRAPHICS sometime before entering SURFMODL (or
  1078. better yet, put it in your AUTOEXEC.BAT); then the <Shift>-<PrtSc>
  1079. combination will copy the current screen to the printer, even in
  1080. graphics mode.
  1081.       A better solution to the problem is to use Colour Snap, a
  1082. shareware utility (which I did not write) that I am now including
  1083. on the SURFMODL distribution disks in the SURFPRNT module.  This
  1084. supports a wide range of color printers (as well as black-and-
  1085. white) and several graphics modes.  Unfortunately, it does not
  1086. presently support the 256-color VGA modes, although the author has
  1087. told me he is working on this.  See the documentation that came in
  1088. the SURFPRNT module for details on its use, and write to the author
  1089. if you want to find out as soon as the full VGA support is added.
  1090.        There are also several commercial TSR screen dump programs
  1091. available, which you may want to consider.  Several of them support
  1092. many combinations of screen and printer, including laser printers
  1093. and color support.  The one I have used is called INSET, and is
  1094. produced by Inset Systems Inc. (formerly the American Programmers
  1095. Guild), 12 Mill Plain Road, Danbury CT 06811.  Their telephone
  1096. number is (203)794-0396.  I believe I paid $129 for my copy, but
  1097. that was in 1986 so prices have changed.  INSET supports a large
  1098. number of printers and adapters, and also has many other features
  1099. for merging graphics with your text files, shrinking or enlarging
  1100. images, changing aspect ratios, dithering and color support.  I
  1101. highly recommend it.  I have no affiliation or financial interest
  1102. in Inset Systems Inc.
  1103.               INSTRUCTIONS FOR RECOMPILING SURFMODL 3.00C
  1104.  
  1105.  
  1106.       Included on the SURFMODL distribution disks is a batch file,
  1107. called COMPILE.BAT, which uses the TP line mode to compile the
  1108. program.  For many users, recompiling SURFMODL is as simple as
  1109. executing COMPILE.BAT.  There are, however, some options to
  1110. consider.  You can turn off support for the 80x87 floating point
  1111. processor, control linking of .BGI files in the .EXE file,
  1112. generation of debugging code, generation of shadow processing code,
  1113. and generation of code for "external" graphics devices (the VAXmate
  1114. and Commodore Amiga).
  1115.       Invoking any of these options is quite easy;  you just edit
  1116. the file DEFINES.INC, included on the distribution disks.  Since
  1117. DEFINES.INC is included at the beginning of all the programs and
  1118. units of SURFMODL, a change in this file changes all the files at
  1119. compilation time.  In this file, you will also find comments
  1120. explaining the meaning of each of the optional define statements. 
  1121. Read it for details.
  1122.        I should also mention that trying to compile SURFMODL
  1123. exactly as it is supplied on the distribution diskettes will result
  1124. in an error message.  That is because the top line of DEFINES.INC
  1125. is a comment that has not been commented out.  It was done to
  1126. purposely make you read that file before compiling.  The minimum
  1127. change you must make is to comment out the first few lines of the
  1128. file.
  1129.                    INTERPRETATION OF ERROR MESSAGES
  1130.  
  1131. Following is a list of common error conditions found when running
  1132. SURFMODL, and what to do about them:
  1133.  
  1134. SYMPTOM:  "ERROR: SURFMODL.CFG does not exist."
  1135. ACTION:  You are missing the SURFMODL.CFG file, which must be
  1136. present either in the current directory or the one you keep all
  1137. your data files in.  If you keep data files somewhere other than
  1138. the current directory, you should set an environment variable to
  1139. point to it, as in:
  1140.           SET SURFDIR=C:\SURFMODL\DATA
  1141.  
  1142. SYMPTOM:  "Device driver file not found..." 
  1143. ACTION:  You have tried to run SURFMODL without having the Borland
  1144. Graphic Interface (BGI) file for your graphics adapter in the
  1145. current directory.  All the BGI files used by SURFMODL are provided
  1146. on the SURFMODL release disks.  Copy the one that corresponds to
  1147. your adapter into your current directory before running SURFMODL. 
  1148. If you're not sure, just copy them all into the current directory. 
  1149. Another alternative is to set the environment variable BGIDIR,
  1150. which SURFMODL checks upon startup.  You can set this to hold the
  1151. name of the directory in which you keep your BGI files, as in:
  1152.           SET BGIDIR=C:\TURBO\DRIVERS
  1153.  
  1154. SYMPTOM:  You hear a beep after hitting the 'F' key in SURFMODL (to
  1155. try to save a copy of the current screen to a file), and there is
  1156. no disk activity. 
  1157. ACTION:  SURFMODL could not allocate enough memory to save the
  1158. screen, or else you ran out of disk space.  If you are sure you
  1159. have plenty of disk space, you may be getting the beep simply
  1160. because you do not have enough memory free during the run.
  1161.  
  1162. SYMPTOM:  "Could not allocate memory for bitmaps" (in PLAYBACK) 
  1163. ACTION:  PLAYBACK loads all of the images into memory before
  1164. starting to display them.  Therefore, the more images you request
  1165. to be played back, the more memory required.  You will see this
  1166. message for each file requested in your playback control file that
  1167. cannot fit into memory.  It is a non-fatal error;  all images
  1168. before the ones that exceeded your memory limits will be properly
  1169. displayed.  NOTE: PLAYBACK is capable of using extended memory to
  1170. store the images for animation.  To use this feature, you must have
  1171. an extended memory manager (XMS) loaded, such as HIMEM.SYS,
  1172. Quarterdeck's QEMM, or Qualita's 386MAX.  HIMEM.SYS is provided on
  1173. the SURFMODL distribution disks; just add this line to your
  1174. CONFIG.SYS:
  1175.            DEVICE=HIMEM.SYS
  1176.  
  1177. SYMPTOM:  "Warning:  Focal point outside data limits. Press any
  1178. key..."
  1179. ACTION:  This is not really an error message; it is just a friendly
  1180. warning by SURFMODL that the focal point is outside the limits of
  1181. the object.  If the resulting plot is nothing but a blank screen,
  1182. it does not necessarily mean there is something wrong with your
  1183. data; just that you picked a bad focal point.
  1184.  
  1185. SYMPTOM:  "Error:  You have attempted to plot a concave surface"
  1186. (etc.)
  1187. ACTION:  This message occurs because the arrays in the filled
  1188. surface routine in SURFMODL had their dimension exceeded.  Usually,
  1189. this is only possible if you tried to plot a surface with
  1190. concavities.  If you are sure your surfaces are convex, the easiest
  1191. way to make this message go away is to reduce the magnification
  1192. factor of the plot.  If you see this message often, then the
  1193. constant MAXPTS in SURFMODL.PAS should be raised, and SURFMODL
  1194. recompiled.
  1195.  
  1196. SYMPTOM:  In the wireframe plot, surfaces look more like
  1197. "hourglasses" than quadrilaterals. 
  1198. ACTION:  Your node numbers were not specified in an order to
  1199. complete a circular path around the surface.  For example, if your
  1200. old node numbering was:  1,2,3,4 then try:  1,3,4,2 and your
  1201. problem should be fixed.
  1202.  
  1203. SYMPTOM:  You notice that some surfaces are covering (or partially 
  1204. covering) surfaces that they should be behind. 
  1205. ACTION:  This is usually caused by using surfaces with too high an
  1206. aspect ratio - that is, they are much longer in one direction than
  1207. in the other.  (You may see this in my ROBOT2.SRF data file.)
  1208.  
  1209. SYMPTOM:  You notice surfaces are not being plotted when they
  1210. should be. ACTION:  You probably reversed the direction of the node
  1211. numbering, and ordered them clockwise instead of counter-clockwise
  1212. (when viewed from the visible side of the surface).  (This is the
  1213. case with the base of the robot in my ROBOT2.SRF data file.) One
  1214. fix is to correct the numbering;  another is to change NSIDES from
  1215. 1 to 2.
  1216.                       SURFMODL USER REGISTRATION
  1217.  
  1218.  
  1219.       As a low-cost way to communicate with SURFMODL users, I am
  1220. making the following offer:  If you mail me a self-addressed,
  1221. stamped envelope (SASE), I will keep you informed of the latest
  1222. developments in SURFMODL.  If you are not from North America, you
  1223. can instead send one International Postal Coupon and a self-
  1224. addressed envelope.  Please don't expect an immediate reply;  I am
  1225. only going to mail out notices when I have compiled enough material
  1226. to make it worthwhile.  You would be amazed at the number of people
  1227. who have written to me, asking to be included on the mailing list,
  1228. without including any postage.  I don't ask for contributions or
  1229. any other payment, so I really think this is a reasonable request
  1230. in return for a promise to keep you up to date.
  1231.        I welcome you to send me copies of your data files for new
  1232. and interesting objects that you display with SURFMODL, and I
  1233. certainly welcome enhancements to SURFMODL or any of its support
  1234. programs.  If you don't stipulate otherwise, I will assume that any
  1235. data files or programs you send me are intended for general
  1236. distribution.  I really look forward to seeing what other people
  1237. can do.
  1238.        I have purposely avoided printing a "registration form" in
  1239. the documentation, as is so popular, because I want to get a letter
  1240. from you -- not just a form.  Let me know what you think about
  1241. SURFMODL, how you think it could be enhanced, and, most
  1242. importantly, what you're using it for.  I really enjoy hearing
  1243. about other people's appplications.  If you write to report bugs,
  1244. please stipulate which version you are running, and on what type of
  1245. computer/graphics board.
  1246.                           UPGRADING SURFMODL
  1247.  
  1248.  
  1249.       If you want to keep up with the latest version of SURFMODL,
  1250. first of all you have to register;  that much is obvious.  In
  1251. addition, you will want to know how you can obtain a copy of the
  1252. latest version of SURFMODL.  In the past, I have sent my newest
  1253. releases to a public domain sales company called MicroCom Systems,
  1254. and encouraged people to go there for their diskettes.  Now,
  1255. unfortunately, MicroCom is no longer responding to my letters.  I
  1256. have sent them two SURFMODL updates without getting so much as a
  1257. note verifying receipt.  Therefore, I am dropping my recommendation
  1258. to use them and will now start distributing SURFMODL myself on
  1259. diskette.  Although I will mail SURFMODL anywhere in the world,
  1260. there are also a few other distribution sites for SURFMODL which
  1261. may be more convenient for you.  Check the file DISTRIB.DOC on the
  1262. distribution disks, for an up-to-date listing of prices and other
  1263. distribution sites.  These are not commercial companies;  they are
  1264. just other SURFMODL users like yourself.
  1265.        Below is my present address.  I prefer not to get too many
  1266. phone calls, but if you feel you have something important that is
  1267. too difficult to put down on paper (or you want to make a business
  1268. proposition!), by all means give me a call.  You can get my number
  1269. from information.
  1270.  
  1271.           Kenneth Van Camp
  1272.           RD #1 Box 1255
  1273.           East Stroudsburg, PA  18301
  1274.           U.S.A.
  1275.